﻿/***********************************
* create date: 2010-1-18
********************************/

var GMapExtentSearch = function (map_,fncallback){
    this.map = map_;
    this.gLocalSearch = new google.search.LocalSearch();
    this.gLocalSearch.setCenterPoint(this.map);
    this.gLocalSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
    this.gLocalSearch.setSearchCompleteCallback(this, function() {
        if (this.gLocalSearch.results) {
            var backArray = [];
            var latArray=[];
            var lngArray=[];
            for (var i = 0; i < this.gLocalSearch.results.length; i++) {
                backArray.push(this.gLocalSearch.results[i].titleNoFormatting);
                latArray.push(this.gLocalSearch.results[i].lat);
                lngArray.push(this.gLocalSearch.results[i].lng);
            }
            if(fncallback != null)
                fncallback(backArray,latArray,lngArray);
        }
    })
}

GMapExtentSearch.prototype = {
    execute : function(key) {
       this.gLocalSearch.execute(key);
    }
}    